<template>
    <view class="successPage">
        <view class="iconBox">
            <image src="/static/my/sign.success.png"  mode=""></image>
            <text>转赠成功</text>
        </view>

		 <view class="btn" @click="repaymentSu">返回我的</view>
        
    </view>
</template>

<script>
	var goldPlan = require('../../../../common/jgoldplan-1.0.0.js');
	import api from '@/api/api.js'
    export default {
        data() {
            return {
               num: 0, 
               data: {},
			   url:'',
            }
        },
		props:{
		  orderId: String,
		},
        created(){
		   this.url = this.domainName
           this.getPayResult(this.orderId)
        },
        methods: {
            async getPayResult(){
            	// console.log(id)
            	var _this = this
            	uni.showLoading({
            		title:'加载中'
            	})
            	try{
            		var res = await this.$api.getDonationPayResult(this.orderId)
            		if(res.result != ''){
            			  this.data = res.result
            			  uni.hideLoading()
            		}else{
            			if(this.num < 20){
            				setTimeout(res=>{
            					 _this.num++
            					 _this.getPayResult()
            				},1000)
            			}else{
            				uni.hideLoading()
            			}
            		}
            	}catch{
            		uni.hideLoading()
            	}
            },
			repaymentSu(){
				var mchData = {
					action: 'jumpOut',
					jumpOutUrl: this.url+'/pages/my/my' //跳转的页面
				}				
				var pData = JSON.stringify(mchData);
				parent.postMessage(pData, 'https://payapp.weixin.qq.com')
				
			}
        }
    }
</script>

<style scoped>
.successPage{
    background: #fff;
    display: flex;
    flex-direction: column;
     align-items: center;
}
.iconBox {
    margin-top: 112rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.iconBox image{
    width: 152rpx;
    height: 152rpx;
    border-radius: 50%;
}
.btn{
    width: 320rpx;
    height: 80rpx;
    border: 2rpx solid #1085F2;
    text-align: center;
    line-height: 80rpx;
    color: #0B87F2;
    border-radius: 80rpx;
    margin-top: 100rpx;
}
</style>
